package piwan;

public class Ray {
	public Ray( Vector3 ip1, Vector3 ip2 ) {
		p1 = ip1.clone();
		p2 = ip2.clone();
		if(p2.y>p1.y){
			Vector3 paux = p1;
			p1 = p2;
			p2 = paux;
		}
	}
	
	public Vector2 intersectXZ() {
		double i = -p2.y/(p1.y-p2.y);
		double mi = 1.0-i;
		
		return new Vector2(p1.x*i + p2.x*mi,p1.z*i + p2.z*mi);
	}
	
	
	private Vector3 p1,p2;
}
